package info.motteke.kurumi.swt;

import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;

final class ColorPattern {

    private static final Display disp = Display.getDefault();

    public static final Color WHITE = color("#FFFFFF");

    public static final Color LIGHT_PINK = color("#FFB6C1");

    public static final Color LIGHT_YELLOW = color("#FFFFE0");

    public static final Color YELLOW = color("#FFFF00");

    public static final Color BLACK = color("#000000");

    private static final Color color(String colorCode) {
        if(colorCode.startsWith("#")){
            colorCode = colorCode.substring(1);
        }
        int radix = 16;

        int red = Integer.parseInt(colorCode.substring(0, 2), radix);
        int green = Integer.parseInt(colorCode.substring(2, 4), radix);
        int blue = Integer.parseInt(colorCode.substring(4, 6), radix);

        return new Color(disp, red, green, blue);
    }
}
